//引入封装好的接口
import {getCateList} from '@/util/axios'
const state={
    cateList:[]
}
const getters={
    getCateList(state){
        return state.cateList
    }
}
const mutations={
    REQ_CATELIST(state,payload){
        state.cateList=payload
    }
}
const actions={
    //封装一个获取菜单列表的行动
    getCateListAction({commit}){
        getCateList().then(res=>{
            if(res.data.code==200){
                commit('REQ_CATELIST',res.data.list)
            }
        })
    }
}
export default{
    state,
    getters,
    mutations,
    actions,
    namespaced: true
}